home *** CD-ROM | disk | FTP | other *** search
/ DarkBASIC - The Ultimate 3D Game Creator / PCactive 8 CD1 - DarkBasic.iso / SOFTWARE / DEMOS / DarkForge2000 / megascroller / back_to_the_roots.dba next >
Encoding:
Text File  |  2000-07-05  |  3.8 KB  |  228 lines

  1. ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  2. `           Back to the Roots
  3. ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4. ` By Rich Davey (rich@fatal-design.com)
  5. ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  6. ` Music listened  to while  coding this
  7. ` Headrush CD 2 (The Tidy Boys Mix)
  8. ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  9. ` Note: This was just made for "fun" 
  10. ` and to show how to use my scroller
  11. ` routine - and also to re-create those
  12. ` classic demo days :-)
  13.  
  14. sync rate 0
  15. sync on
  16. hide mouse
  17.  
  18. x=0 : y=0 : ox=32 : oy=25 : os=2 : s=8 : bw#=ox*os
  19.  
  20. load bitmap "demo_2.bmp",31
  21. load image "demo_3.bmp",10000
  22. load bitmap "knight6.bmp",1
  23.  
  24. set current bitmap 1
  25.  
  26. for i=1 to 60
  27.  
  28.     get image i,x,y,x+ox,y+oy
  29.     inc x,ox
  30.  
  31.     if x>=319
  32.         x=0
  33.         inc y,oy
  34.     endif
  35.  
  36.     sync
  37.  
  38. next i
  39.  
  40. i=1
  41.  
  42. create bitmap 2,640,480
  43.  
  44. if os>1
  45.  
  46.     for z=61 to 120
  47.     
  48.         create bitmap 1,ox*os,oy*os
  49.         paste image i,0,0
  50.         set current bitmap 2
  51.         copy bitmap 1,0,0,ox,oy,2,0,0,ox*os+os,oy*os
  52.         get image z,0,0,ox*os+os,oy*os
  53.         inc i
  54.     
  55.     next z
  56.  
  57. else
  58.  
  59.     print "Cannot have OS size less than 2"
  60.     end
  61.  
  62. endif
  63.  
  64. set current bitmap 0
  65. delete bitmap 2
  66.  
  67. bc=640/bw#+1
  68.  
  69. for a=1 to bc
  70.  
  71.     st$=st$+" "
  72.  
  73. next a
  74.  
  75. read s$
  76. st$=st$+s$
  77. lot=len(st$)+1
  78. if lot<12 then st$=st$+"           "
  79.  
  80. dim x#(bc)
  81. dim t$(bc)
  82.  
  83. for a=1 to bc
  84.  
  85.     x#(a)=bw#*a
  86.     t$(a)=mid$(st$,a)
  87.     as=asc(t$(a))
  88.     sprite a,x#(a),0,29+as
  89.     set sprite a,0,1
  90.  
  91. next a
  92.  
  93. y=(480-oy)/2 : t=bc
  94.  
  95. randomize 1000
  96. stars=150
  97.  
  98. dim stx#(stars) 
  99. dim sty#(stars)
  100.  
  101. for i = 1 to stars
  102.     stx#(i)=rnd(640.0)-320.0
  103.     sty#(i)=rnd(480.0)-240.0
  104. next i
  105.  
  106. sx#=1.03985 : sy#=1.03985
  107. slidex#=320.0 : slidey#=240.0
  108.  
  109. dim sine#(360)
  110.  
  111. for y=0 to 360
  112.     x#=sin(y)
  113.     sine#(y)=x#*200
  114. next y
  115.  
  116. load image "demo_1.bmp",250
  117.  
  118. for cospr=250 to 300
  119.     sprite cospr,-256,0,250
  120.     set sprite cospr,0,1
  121. next cospr
  122.  
  123. spr=2 : i=1 : speed=4
  124.  
  125. ink rgb(255,255,255),0 : ot=timer() : raster$="off" : y=0
  126.  
  127. dim sine#(360)
  128.  
  129. do
  130.  
  131.     cls 0
  132.  
  133.     paste image 10000,180,285
  134.  
  135.     if timer()>ot+5000 then raster$="on"
  136.     if timer()>ot+13000 then star$="on"
  137.     if timer()>ot+30000 then ball$="on"
  138.  
  139.     if raster$="on"
  140.  
  141.         inc ry
  142.         if ry=480-(oy*os) then ry=0
  143.     
  144.         set current bitmap 31
  145.         get image 121,0,ry,640,ry+(oy*os)-8
  146.         set current bitmap 0
  147.     
  148.         paste image 121,0,153+sin(y)*100
  149.  
  150.     endif
  151.  
  152.     for a=1 to bc
  153.  
  154.         x#=x#(a)
  155.  
  156.         dec x#,s
  157.  
  158.         if x#=<-0-bw#
  159.             x#(a)=640
  160.             inc t
  161.             if t=lot
  162.                 t=1
  163.                 read st$
  164.                 if st$="*"
  165.                     restore
  166.                     read st$
  167.                 endif
  168.                 lot=len(st$)+1
  169.             endif
  170.             t$(a)=mid$(st$,t)
  171.         else
  172.             x#(a)=x#
  173.         endif
  174.  
  175.         as=asc(t$(a))
  176.         sprite a,x#(a),150+sin(y)*100,29+as
  177.  
  178.     next a
  179.  
  180.     if star$="on"
  181.  
  182.         for j=1 to stars
  183.             dot stx#(j)+slidex#,sty#(j)+slidey#
  184.             stx#(j)=stx#(j)*sx#
  185.             sty#(j)=sty#(j)*sy#
  186.             if stx#(j) > 640.0 then stx#(j)=stx#(j)-640.0
  187.             if sty#(j) > 480.0 then sty#(j)=sty#(j)-480.0
  188.             if stx#(j) < -640.0 then stx#(j)=stx#(j)+640.0
  189.             if sty#(j) < -480.0 then sty#(j)=sty#(j)+480.0
  190.         next j
  191.  
  192.     endif
  193.  
  194.     if ball$="on"
  195.  
  196.         for cx=1 to 22
  197.     
  198.         sprite 249+cx,200+(cx*6)+cos(wrapvalue(d+(cx*10)))*100,100+(cx*8)+sin(wrapvalue(d+cx*6))*100,250
  199.     
  200.         next cx
  201.     
  202.         spr=spr+speed
  203.         if spr>129 then spr=2
  204.         i=1 : inc d,2
  205.  
  206.     endif
  207.  
  208.     inc y
  209.     if y=360 then y=0
  210.  
  211.     if spacekey() then end
  212.  
  213.     sync
  214.  
  215. loop
  216.  
  217. data "HEY... HOW ABOUT SOME RASTERS? YEAAHHHH... DARKFORGE KICKS IT AGAIN! "
  218. data "OKAY, STARS ANYONE? ........... "
  219. data "LOVELY ISN'T IT?  AND YES, THERE IS MORE TO COME! THIS MIGHT "
  220. data "KILL YOUR MACHINE, SORRY! BUT BRING ON THE BALLS! .............. "
  221. data "OKAY IT IS TIME FOR THE GREETINGS OF COURSE! "
  222. data "KUDOS FLY OUT TO.. TRACER! (THE SMOKING DRINKING CODING MASTER), "
  223. data "LEE (MAY WE BOW TO YOU!), PJAY, SI, WARPY, CHRIS, ARBITAGE AND THE REST OF "
  224. data "THE MOB ON IRC.CJB.NET !  THIS IS RICH DOING THAT WRAP THING ..."
  225. data "              "
  226. data "*"
  227.  
  228.